
import Head from 'next/head'

<Head>
  <script>
    {
      `(function() {
         var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?e60fb290e204e04c5cb6f79b0ac1e697";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
       })();`
    }
  </script>
</Head>

![LangChain](https://pica.zhimg.com/50/v2-56e8bbb52aa271012541c1fe1ceb11a2_r.gif)





AWS S3目录[#](#aws-s3-directory "此标题的永久链接")
=========================================

> 
> [Amazon Simple Storage Service（Amazon S3)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders)是一项对象存储服务
> 
> 
> 

> 
> [AWS S3目录](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders)
> 
> 
> 

本文介绍如何从`AWS S3 目录`对象中加载文档对象。

```python
#!pip install boto3

```

```python
from langchain.document_loaders import S3DirectoryLoader

```

```python
loader = S3DirectoryLoader("testing-hwc")

```

```python
loader.load()

```

指定前缀[#](#specifying-a-prefix "此标题的永久链接")
----------------------------------------

您还可以指定前缀以更精细地控制要加载的文件。

```python
loader = S3DirectoryLoader("testing-hwc", prefix="fake")

```

```python
loader.load()

```

```python
[Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': '/var/folders/y6/8_bzdg295ld6s1_97_12m4lr0000gn/T/tmpujbkzf_l/fake.docx'}, lookup_index=0)]

```

